<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><%=title%></title>
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="/bootstrap-3.3.5/css/bootstrap.min.css">

<!-- 可选的Bootstrap主题文件（一般不用引入） -->
<link rel="stylesheet" href="/bootstrap-3.3.5/css/bootstrap-theme.min.css">

<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="/js/jquery.min.js"></script>

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<style type="text/css"></style>
</head>

<body>
<div class="container">
<nav class="navbar navbar-inverse">
  <div class="container-fluid"> 
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-9" aria-expanded="false"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
      <a class="navbar-brand" href="#">博客</a> </div>
    
    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-9">
      <ul class="nav navbar-nav">
        <li><a href="/">首页</a></li>
        <% if (user) { %>
        <li> <a href="/user/<%=user._id%>"><%=user.name%></a></li>
        <li><a href="/add">发表</a></li>
        <li><a href="/list">列表</a></li>
        <li><a href="/logout">退出</a></li>
        <% } else { %>
        <li> <a href="/login">登录</a></li>
        <li> <a href="/reg">注册</a></li>
        <% } %>
      </ul>
    </div>
    <!-- /.navbar-collapse --> 
  </div>
  <!-- /.container-fluid --> 
</nav>
</div>
